//工具类
import API from './api'

let url="http://www.yeiyi.com:8080/";

export default class Utils{

    /**
     * 注册用户
     * @param {*} userId 
     */
    register(userId){
       let res = API.queryRequest(url+"airwarback/getinfo",{userId:userId});
       console.log(res);
       return res  
    }

    /**
     * 更换选手
     * @param {*} userId 
     * @param {*} fightDriverIndex 
     */
    updateFightPlayer(userId,fightDriverIndex){
        API.queryRequest(url+"airwarback/updatefightplayer",{userId:userId,fightIndex:fightDriverIndex});
    }

    /**
     * 修改选手昵称
     * @param {*} userId 
     * @param {*} nameIndexStr 
     * @param {*} nameChangeableStr 
     */
    UpdatePlayer(userId,nameIndexStr,nameChangeableStr){
        API.queryRequest(url+"airwarback/updateplayer",{userId:userId,nameIndex:nameIndexStr,nameChangeable:nameChangeableStr},successFuc);
    }


    /**
     * 修改飞机等级
     * @param {*} userId 
     * @param {*} myCoin 
     * @param {*} myDiamond 
     * @param {*} planeLevelStr 
     * @param {*} materialArrayStr 
     */
    UpdatePlaneLevel(userId,myCoin,myDiamond,planeLevelStr,materialArrayStr){
        API.queryRequest(url+"airwarback/updateplane",{userId:userId,coin:myCoin,diamond:myDiamond,planeLevel:planeLevelStr,materialArray:materialArrayStr});
    }

    /**
     * 修改宠物等级
     * @param {*} userId 
     * @param {*} myCoin 
     * @param {*} myDiamond 
     * @param {*} petLevelStr 
     * @param {*} materialArrayStr 
     */
    UpdatePetLevel(userId,myCoin,myDiamond,petLevelStr,materialArrayStr){
        API.queryRequest(url+"airwarback/updatepet",{userId:userId,coin:myCoin,diamond:myDiamond,petLevel:petLevelStr,materialArray:materialArrayStr});
    }

    /**
     * 更新tool等级
     * @param {*} userId 
     * @param {*} myCoin 
     * @param {*} myDiamond 
     * @param {*} toolArrayStr 
     * @param {*} hasLottoChanceInt 
     */
    UpdateTool(userId,myCoin,myDiamond,toolArrayStr,hasLottoChanceInt){
        API.queryRequest(url+"airwarback/updatetool",{userId:userId,coin:myCoin,diamond:myDiamond,toolArray:toolArrayStr,hasLottoChance:hasLottoChanceInt});
    }


    /**
     * 全部 更新参数
     * @param {*} userId 
     * @param {*} myCoin 
     * @param {*} myDiamond 
     * @param {*} myMaxScore 
     * @param {*} materialArrayStr 
     * @param {*} toolArrayStr 
     * @param {*} missionUnlockStr 
     * @param {*} currentBlackStage 
     * @param {*} blackUnlockInt 
     */
    UpdateTotal(userId,myCoin,myDiamond,myMaxScore,materialArrayStr,toolArrayStr,missionUnlockStr,currentBlackStage,blackUnlockInt){
        API.queryRequest(url+"airwarback/updatetotal",{userId:userId,coin:myCoin,diamond:myDiamond,maxScore:myMaxScore,materialArray:materialArrayStr,toolArray:toolArrayStr,missionUnlock:missionUnlockStr,blackLevel:currentBlackStage,blackUnlock:blackUnlockInt});
    }


}